package com.janj.controller;

import com.janj.bean.Course;
import com.janj.bean.Student;
import com.janj.service.CourseOnStudentService;
import com.janj.service.CourseOnStudentServiceImpl;
import org.junit.Test;

import java.util.List;

public class CourseOnStudentDemo {

    @Test
    public void testSelectCourseOnStudent(){
        CourseOnStudentService service = new CourseOnStudentServiceImpl();
        List<Course> array = service.selectCourseOnStudent();
        System.out.println("----------------");
        for (Course c : array) {
            String cname = c.getCname();
            List<Student> list = c.getStudnets();
            for (Student stu : list) {
                Integer sid = stu.getSid();
                String sname = stu.getSname();
                Integer age = stu.getAge();
                System.out.println(sid+","+sname+","+age+","+cname);
            }
        }

    }
}
